define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, undefined, Frontend, Form, Template) {
    var validatoroptions = {
        invalid: function (form, errors) {
            $.each(errors, function (i, j) {
                Layer.msg(j);
            });
        }
    };
    var Controller = {
        index: function () {
            //连接socket
            var ws = new WebSocket("ws://"+Config.swoole_url);
            ws.onopen = function(evt) {
                var start_data = '{"game":"landlord","action":"connect","data":{"user_id":"'+Config.user.id+'","username":"'+Config.user.nickname+'"}}';
                ws.send(start_data);
            };

            ws.onmessage = function(evt) {
                var data = evt.data;
                if(data.code != 200){
                    console.log(data);
                }
                switch (data.type) {
                    case 1:
                }
            };
        },

    };
    return Controller;
});
